using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using ShootThemUp.Sources.GameElements.Ships.Ennemies.Fruits;

namespace ShootThemUp.Sources.GameElements.Animations
{
    public class FruitExplosion : Animation
    {
        #region Spritesheet Constants Fields

        /// <summary>
        /// The X position of the player ship texture in the spritesheet (in px).
        /// </summary>
        private const int SPRITESHEET_POSITION_X = 0;
        /// <summary>
        /// The Y position of the player ship texture in the spritesheet (in px).
        /// </summary>
        private const int SPRITESHEET_POSITION_Y = 408;
        /// <summary>
        /// The width of the player ship texture in the spritesheet (in px).
        /// </summary>
        private const int SPRITESHEET_WIDTH = 90;
        /// <summary>
        /// The height of the player ship texture in the spritesheet (in px).
        /// </summary>
        private const int SPRITESHEET_HEIGHT = 70;
        /// <summary>
        /// The number of sprites used to animate the ship.
        /// </summary>
        private const int NUMBER_OF_FRAME = 3;
        /// <summary>
        /// The duration of a frame of the animation.
        /// </summary>
        private const float ANIMATION_DURATION = 0.01f;

        #endregion

        #region Initialization

        /// <summary>
        /// Initializes a new instance of the <see cref="Explosion"/> class.
        /// </summary>
        /// <param name="x">The x-position.</param>
        /// <param name="y">The y-position</param>
        public FruitExplosion(Vector2 position, FruitType type)
            : base(position,
             new Rectangle(FruitExplosion.SPRITESHEET_POSITION_X, FruitExplosion.SPRITESHEET_POSITION_Y, FruitExplosion.SPRITESHEET_WIDTH, FruitExplosion.SPRITESHEET_HEIGHT),
             FruitExplosion.NUMBER_OF_FRAME,
             FruitExplosion.SPRITESHEET_WIDTH,
             FruitExplosion.ANIMATION_DURATION)
        {
            if (type.Equals(FruitType.Cherry))
                this.Color = Color.Red;
            else if (type.Equals(FruitType.Orange))
                this.Color = Color.DarkOrange;
            else if (type.Equals(FruitType.Pear))
                this.Color = Color.LawnGreen;
            
        }

        #endregion
    }
}
